%ifndef BOOT_PROTECTEDMODEUTILITY_VIDEOTEXTMODEPOSITIONCURSOR
%define BOOT_PROTECTEDMODEUTILITY_VIDEOTEXTMODEPOSITIONCURSOR
; void __cdecl VideoTextModePositionCursor(DWORD dwPosition)
%define dwPosition dword [ebp + 8]
bits 32
VideoTextModePositionCursor:
    push ebp
    mov ebp, esp
    push ebx
    mov ebx, dwPosition ; 取出地址，有效数据存放在 bx 中

    mov dx, 0x03D4 ; CRT Controller Address Register
    mov al, 0x0E ; Cursor Location High Register
    out dx, al ; select CRT Controller Address Register -> Cursor Location High Register
    mov dx, 0x03D5 ; CRT Controller Data Register
    mov al, bh ; High Address
    out dx, al ; Write High Cursor Location

    mov dx, 0x03D4 ; CRT Controller Address Register
    mov al, 0x0F ; Cursor Location Low Register
    out dx, al ; select CRT Controller Address Register -> Cursor Location Low Register
    mov dx, 0x03D5 ; CRT Controller Data Register
    mov al, bl ; Low Address
    out dx, al ; Write Low Cursor Location
    
    pop ebx
    mov esp, ebp
    pop ebp
    ret
%undef dwPosition
%endif